




using Hotpot.Modules.Membership.ViewModels;
using Hotpot.ViewModels;

namespace Hotpot.Modules.Membership.Extensions
{
    public static class HotpotViewModelExtensions
    {
        public static UserViewModel GetUser(this HotpotViewModel model)
        {
            return model.GetModelItem<UserViewModel>();
        }

        public static string GetSignInUrl(this HotpotViewModel model)
        {
            MembershipUrlViewModel viewModel = model.GetModelItem<MembershipUrlViewModel>();

            if (viewModel != null)
                if (!string.IsNullOrEmpty(viewModel.SignInUrl))
                    return viewModel.SignInUrl;

            return "";
        }

        public static string GetSignOutUrl(this HotpotViewModel model)
        {
            MembershipUrlViewModel viewModel = model.GetModelItem<MembershipUrlViewModel>();

            if (viewModel != null)
                if (!string.IsNullOrEmpty(viewModel.SignOutUrl))
                    return viewModel.SignOutUrl;

            return "";
        }

        //TODO: (erikpo) Add method for registration url
    }
}